//
//  ProtocolViewController.swift
//  test_swift
//
//  Created by fangyuan ding on 2021/6/1.
//

import UIKit
protocol classa {
    
    var marks: Int { get set }
    var result: Bool { get }
    
    func attendance() -> String
    func markssecured() -> String
    
}

protocol classb: classa {
    
    var present: Bool { get set }
    var subject: String { get set }
    var stname: String { get set }
    
}
protocol daysofaweek {
    mutating func show()
}

enum days: daysofaweek {
    case sun, mon, tue, wed, thurs, fri, sat
    mutating func show() {
        switch self {
        case .sun:
            self = .sun
            print("Sunday")
        case .mon:
            self = .mon
            print("Monday")
        case .tue:
            self = .tue
            print("Tuesday")
        case .wed:
            self = .wed
            print("Wednesday")
        case .thurs:
            self = .thurs
            print("Wednesday")
        case .fri:
            self = .fri
            print("Firday")
        case .sat:
            self = .sat
            print("Saturday")
        default:
            print("NO Such Day")
        }
    }
}
class ProtocolViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
      
        var res = days.wed
        res.show()
        
        
        class classc: classb {
            var marks = 96
            let result = true
            var present = false
            var subject = "Swift 协议"
            var stname = "Protocols"
            
            func attendance() -> String {
                return "The \(stname) has secured 99% attendance"
            }
            
            func markssecured() -> String {
                return "\(stname) has scored \(marks)"
            }
        }

        let studdet = classc()
        studdet.stname = "Swift"
        studdet.marks = 98
        studdet.markssecured()

        print(studdet.marks)
        print(studdet.result)
        print(studdet.present)
        print(studdet.subject)
        print(studdet.stname)
    }
    


}
